<?php
session_start();

define("ORA_CON_UN", "cscd494");             // username
define("ORA_CON_PW", "R3tral435");             // password
define("ORA_CON_DB", "//146.187.134.17:1542/oracle10g"); // connection

$SITE_BASE_URL = "http://cscd494-l.cslabs.ewu.edu/retral"; //site base URL

class change_request {
	var $deleted = 0;
	var $requestValue = 1;
	var $responseValue = 2;

	var $request = array("new"         => 2,
	                     "correction"  => 3,
	                     "remove"      => 4);
	var $response = array("approve"    => 7,
	                      "improve"    => 8,
	                      "remove"     => 9);

	function getApprovalQuery($rev, $cr) {
		$query = '
			UPDATE change_request
			SET request_code = ';

		if($rev == $this->response["approve"]) {
			if($cr == $this->request["remove"]) {
				// Update the request_code to be deleted
				$query .= $this->deleted;
			} else {
				// Remove CR from table
				$query = '
					DELETE FROM change_request';
			}
		} else if($rev == $this->response["remove"]){
			// Update the request_code to be deleted
			$query .= $this->deleted;
		} else {
			// Assign the $rev value to the CR request code
			$query .= $rev;
		}

		return $query;
	}
}

$approval = new change_request();

?>
